#include<bits/stdc++.h>
using namespace std;
const int N=1e5+7;
int n,cnt,ans,r[N],sum[N],vis[N];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&r[i]);
        if(!vis[r[i]])
        {
            vis[r[i]]=++cnt;
            sum[cnt]++;
        }
        else sum[vis[r[i]]]++;
    }
    for(int i=1;i<=cnt;i++)
    {
        int x=i-1,tmp=sum[i];
        while(x>0)
        {
            if(tmp<=sum[x])
            {
                ans+=tmp;
                sum[x]-=tmp;
                tmp=0;
                break;
            }
            else ans+=sum[x],tmp-=sum[x],sum[x]=0;
            x--;
        }
    }
    printf("%d\n",n-ans);
    return 0;
}
